<?php
defined ( '_FW_EXEC' ) or die ( 'Restricted access' );
RClassesImporter::cls("dbo.dtos.EventDTO" );
RClassesImporter::cls('dbo.dtos.Member_eventDTO');
class EventModel { 

	function delete($arrId) {
		$result = false;
		if (is_array($arrId)) {
			$arrId = implode(',', $arrId);
		}
		$sQuery		=	"DELETE FROM event  WHERE id IN ({$arrId}) ";
		return SysDatabase::execute( $sQuery );
	}

	function deleteMemberEvent($arrId) {
		$result = false;
		if (is_array($arrId)) {
			$arrId = implode(',', $arrId);
		}
		$sQuery		=	"DELETE FROM member_event  WHERE id IN ({$arrId}) ";
		return SysDatabase::execute( $sQuery );
	}

	function getMemberbyEvent($id){
		$sql= "SELECT * FROM member_event WHERE event_id = '$id' ORDER BY id DESC";
		return SysDatabase::loadObjectList($sql);
	}
	function getEventDetails($id) {
		$my_Obj = new EventDTO();
		$my_Obj->setKeyValue($id);
		SysDatabase::fillData($my_Obj);
		return $my_Obj;
	}

	function saveMemberDTO($dto){
		return SysDatabase::saveDTO($dto);
	}

	function getEventPaging($page, $limit) {
		$sql = "SELECT * FROM event ORDER BY id DESC";
		return SysDatabase::getSelectResult($sql, $limit, $page);
	}
	function loadListEvent(){
		$sql= "SELECT * FROM event ORDER BY id DESC";
		return SysDatabase::loadObjectList($sql);
	}
	function loadEventDetails($id){
		$sql= "SELECT * FROM event WHERE id = '$id'";
		return SysDatabase::loadObject($sql);
	}

	function saveEventDTO($dto){
		return SysDatabase::saveDTO($dto);
	}


	function getTranscationLog($id) {
		$finder = new TranscationFinder();
		$finder->member_id = $id;
		return SysDatabase::getSelectResult($finder->getSelectSQL());
	}
}
?>